﻿using Games.Basic;
using Games.Common;
using Xamarin.Forms;

namespace Games.SeriesLights
{
    class GameInfo : BaseViewModel, IGameInfo
    {
        public string Name => "连环灯";
        public string Desc => "游戏目标：点亮所有格子。\r\n游戏规则：\r\n1：每个格子隐藏一个数字；\r\n2：按照隐藏从小到大的顺序点亮格子；\r\n3：按下一个格子时如果有更大数字的格子被点亮则点亮失败，并灭掉所有比他大的格子。";
        public string Version => "1.0";
        public string ID => "846B7F14-550B-4300-86C8-B0379C508F02";
        public string BuildDate => "20201228";
        public ContentPage NewPage() => PageHolder.Get(() => new Light(this));

        public int AllCount
        {
            get { return this.width * this.height; }
        }

        int clickCount = 0;
        public int ClickCount
        {
            get { return clickCount; }
            set { SetProperty(ref clickCount, value); }
        }

        private int width;
        private int height;
        public int Width
        {
            get
            {
                return width;
            }
            set
            {
                SetProperty(ref width, value);
                OnPropertyChanged("AllCount");
                OnPropertyChanged("Size");
            }
        }
        public int Height
        {
            get
            {
                return height;
            }
            set
            {
                SetProperty(ref height, value);
                OnPropertyChanged("AllCount");
                OnPropertyChanged("Size");
            }
        }

        public string Size { get { return $"{this.width}*{this.height}"; } }
    }
}